// history.js
const app = getApp()
Page({
  data: {
    records: [],
    filteredRecords: []
  },
  onLoad: function () {
    this.setData({
      records: app.globalData.records,
      filteredRecords: app.globalData.records
    })
  },
  filterByDate: function (e) {
    const selectedDate = e.detail.value
    const filteredRecords = this.data.records.filter(record => 
      record.date === selectedDate
    )
    this.setData({ filteredRecords })
  }
})
